#ifndef GRAPHIC_DATA_COMMANDS_H
#define GRAPHIC_DATA_COMMANDS_H

#include "../documents/data/graphicdata.h"

#include <ieditoritem.h>

#include <QtCore/QList>
#include <QtGui/QUndoCommand>

namespace swp
{

class AddGraphicItemCommand : public QUndoCommand
{
public:
    AddGraphicItemCommand(GraphicData* data,
        core::IGraphicEditorItem* item);
    virtual ~AddGraphicItemCommand();

    void undo();
    void redo();

protected:
    bool m_shouldDelete;
    GraphicData* m_data;
    core::IGraphicEditorItem* m_item;
};

class RemoveGraphicItemCommand : public QUndoCommand
{
public:
    RemoveGraphicItemCommand(GraphicData* data,
        core::IGraphicEditorItem* item);
    virtual ~RemoveGraphicItemCommand();

    void undo();
    void redo();

protected:
    bool m_shouldDelete;
    GraphicData* m_data;
    core::IGraphicEditorItem* m_item;
    QList<core::ConnectionData> m_connections;
};

class AddConnectionCommand : public QUndoCommand
{
public:
    AddConnectionCommand(GraphicData* data,
        core::IGraphicEditorItem* connector,
        const core::ConnectionData& connection);
    ~AddConnectionCommand();

    void undo();
    void redo();

private:
    bool m_shouldDelete;
    GraphicData* m_data;
    core::IGraphicEditorItem* m_connector;
    core::ConnectionData m_connection;
};

class RemoveConnectionCommand : public QUndoCommand
{
public:
    RemoveConnectionCommand(GraphicData* data,
        core::IGraphicEditorItem* connector,
        const core::ConnectionData& connection);
    ~RemoveConnectionCommand();

    void undo();
    void redo();

private:
    bool m_shouldDelete;
    GraphicData* m_data;
    core::IGraphicEditorItem* m_connector;
    core::ConnectionData m_connection;
};

} // namespace swp

#endif
